.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "DNF4-PRE-TRANSACTION-ACTIONS" "8" "Aug 22, 2024" "4.9.0" "dnf-plugins-core"
.SH NAME
dnf4-pre-transaction-actions \- DNF pre transaction actions Plugin
.SH DESCRIPTION
.sp
The plugin allows to define actions to be executed upon starting an RPM transaction. Each action
may define a (glob\-like) filtering rule on the package NEVRA or package files, as well as whether
the package was installed or removed. Actions are defined in action files.
.SH CONFIGURATION
.sp
The plugin configuration is in \fB/etc/dnf/plugins/pre\-transaction\-actions.conf\fP\&. All configuration
options are in the \fB[main]\fP section.
.INDENT 0.0
.TP
.B \fBenabled\fP
Whether the plugin is enabled. Default value is \fBTrue\fP\&.
.TP
.B \fBactiondir\fP
Path to the directory with action files. Action files must have the “.action” extension.
Default value is “/etc/dnf/plugins/pre\-transaction\-actions.d/”.
.UNINDENT
.SH ACTION FILE FORMAT
.sp
Empty lines and lines that start with a ‘#’ character are ignored.
Each non\-comment line defines an action and consists of three items separated by colons:
\fBpackage_filter:transaction_state:command\fP\&.
.INDENT 0.0
.TP
.B \fBpackage_filter\fP
A (glob\-like) filtering rule applied on the package NEVRA (also in the shortened forms) or
package files.
.TP
.B \fBtransaction_state\fP
Filters packages according to their state in the transaction.
.INDENT 7.0
.IP \(bu 2
\fBin\fP \- packages that will appeared on the system (downgrade, install, obsolete, reinstall, upgrade)
.IP \(bu 2
\fBout\fP \- packages that will disappeared from the system (downgraded, obsoleted, remove, upgraded)
.IP \(bu 2
\fBany\fP \- all packages
.UNINDENT
.TP
.B \fBcommand\fP
Any shell command.
The following variables in the command will be substituted:
.INDENT 7.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fB${name}\fP, \fB$name\fP \- package name
.IP \(bu 2
\fB${arch}\fP, \fB$arch\fP \- package arch
.IP \(bu 2
\fB${ver}\fP, \fB$ver\fP \- package version
.IP \(bu 2
\fB${rel}\fP, \fB$rel\fP \- package release
.IP \(bu 2
\fB${epoch}\fP, \fB$epoch\fP \- package epoch
.IP \(bu 2
\fB${repoid}\fP, \fB$repoid\fP \- package repository id
.IP \(bu 2
.INDENT 2.0
.TP
.B \fB${state}\fP, \fB$state\fP \- the change of package state in the transaction:
“downgrade”, “downgraded”, “install”, “obsolete”, “obsoleted”, “reinstall”,
“reinstalled”, “remove”, “upgrade”, “upgraded”
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.sp
The shell command will be evaluated for each package that matched the \fBpackage_filter\fP and
the \fBtransaction_state\fP\&. However, after variable substitution, any duplicate commands will be
removed and each command will only be executed once per transaction. The order of execution
of the commands follows the order in the action files, but may differ from the order of
packages in the transaction.  In other words, when you define several action lines for the
same \fBpackage_filter\fP these lines will be executed in the order they were defined in the
action file when the \fBpackage_filter\fP matches a package during the \fBtrasaction_state\fP state.
However, the order of when a particular \fBpackage_filter\fP is invoked depends on the position
of the corresponding package in the transaction.
.UNINDENT
.SS An example action file:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# log all packages (state, nevra, repo) in transaction into a file.
*:any:echo \(aq${state} ${name}\-${epoch}:${ver}\-${rel}.${arch} repo ${repoid}\(aq >>/tmp/pre\-trans\-actions\-trans.log

# The same shell command (after variables substitution) is executed only once per transaction.
*:any:echo \(aq${repoid}\(aq >>/tmp/pre\-trans\-actions\-repos
# will write each repo only once to /tmp/pre\-trans\-actions\-repos, even if multiple packages from
# the same repo were matched
.EE
.UNINDENT
.UNINDENT
.SH AUTHOR
See AUTHORS in your Core DNF Plugins distribution
.SH COPYRIGHT
2024, Red Hat, Licensed under GPLv2+
.\" Generated by docutils manpage writer.
.
